﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   namespace="Bunian.Core.BusinessObjects"
                   assembly="Bunian.Core">

  <class name="Contact" table="Contacts">

    <id name="Id" column="ContactId" unsaved-value="0">
      <generator class="native"/>
    </id>
    
    <property name="BirthDate" column="BirthDate" type="System.DateTime"/>
    <property name="Sex" column="Sex" type="System.Int32"/>
    <property name="FullName" column="FullName" type="System.String"/>
    <property name="IsOrganization" column="IsOrganization" type="System.Boolean"/>
    <property name="IsDeceased" column="IsDeceased" type="System.Boolean"/>
    
    <bag name="Addresses" inverse="true" generic="true" cascade="all-delete-orphan">
      <key column="ContactId"/>
      <one-to-many class="ContactAddress" />
    </bag>
  </class>
</hibernate-mapping>